package me.luger.project.picc.service;

import me.luger.core.dao.nutz.service.BaseService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import me.luger.project.picc.entity.SatisfyQuestion;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.springframework.stereotype.Repository;

@Repository
public class SatisfyQuestionService extends BaseService<SatisfyQuestion> {
    public SatisfyQuestionService(Dao dao) {
        super(dao);
    }

    public SatisfyQuestion fetchByOpenId(String openId){
        Sql sql = Sqls.create("select * from satisfyQuestion where openId = @openId order by id desc limit 1");
        sql.setParam("openId",openId);
        return this.fetchOne(sql);
//        return this.fetchOne(Cnd.where("openId","=",openId).orderBy("id","desc"));
    }

    public SatisfyQuestion fetchByPid(String pid){
        return this.fetchOne(Cnd.where("pid","=",pid));
    }
}
